package File;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class Exercise {
    public static void main(String[] args) throws IOException {
        /*
        File dir=new File("./");
        File[] subs=dir.listFiles(file->file.getName().contains("s"));
        for (File sub:subs){
            System.out.println(sub.getName());
        }



       File dir=new File("./");
       if (dir.isDirectory()){
           FileFilter filter=new FileFilter() {
               @Override
               public boolean accept(File file) {
                   String name=file.getName();
                   return name.contains("s");
               }
           };
           File[] subs=dir.listFiles(filter);
           for (File sub:subs){
               System.out.println(sub.getName());
           }

       }

        Scanner scan=new Scanner(System.in);
        String use=scan.next();
        File file=new File("./"+use);
        while (file.exists()){
            System.out.println("已存在,请重新输入：");
            String use1=scan.next();
            File file1=new File("./"+use1);
            file=file1;
        }
            file.mkdir();
        System.out.println("已创建");


        Scanner scan=new Scanner(System.in);
        String use_delete=scan.next();
        File file=new File("./"+use_delete);
        if (file.exists()){
            file.delete();
            System.out.println("已删除");
        }else {
            System.out.println("不存在");
        }


        Scanner scan=new Scanner(System.in);
        String use=scan.next();
        File file=new File("./"+use);
        if (file.exists()){
            System.out.println("已存在");
            }else {
            file.mkdir();
            System.out.println("已创建");
    }


        for (int i=1;i<=100;i++){
            File file=new File("./test"+i+".txt");
            if (file.exists()){
                file.delete();
            }

        }
        System.out.println("删除成功");



        for (int i=1;i<=100;i++){
            File file = new File("./test"+i+".txt");
            if (!file.exists()){
                file.createNewFile();
            }
        }
        System.out.println("创建成功");
         */
    }
}
